import Ember from 'ember';

export default Ember.Route.extend({
  setupController(controller, model) {
      var c = this.controllerFor("treenodes/index/edit");
      c.set('isNewRecord', true); //用来区分新建还是编辑。
      c.set('model', model);
      c.set('editingModel', Ember.Object.create());
    },
    renderTemplate() {
      var tcName = "treenodes/index/edit"
      this.render(tcName, {
        controller: tcName
      });
    },
    valueShareer: Ember.inject.service("value-shareer"),
    model(params) {
      var tree = this.get('valueShareer').get('tree');
      return tree.get('__indexer')[params.nid];
    },
    serialize(model) {
      return {
        nid: model.get('id')
      };
    }
});
